package org.luxor.common.netty.protocol;

import io.netty.util.internal.StringUtil;

/**
 * Netty Request VariableHeader
 *
 * @author Mr.yan @date 2024/1/31
 */
public class NettyConnectVariableHeader {

    private final String clientId;
    private final String username;
    private final String password;

    public NettyConnectVariableHeader(String clientId, String username, String password) {
        this.clientId = clientId;
        this.username = username;
        this.password = password;
    }

    public String clientId() {
        return this.clientId;
    }

    public String username() {
        return this.username;
    }

    public String password() {
        return this.password;
    }

    public static NettyConnectVariableHeader from(String clientId, String username, String password) {
        return new NettyConnectVariableHeader(clientId, username, password);
    }

    public static NettyConnectVariableHeader from(String clientId) {
        return new NettyConnectVariableHeader(clientId, null, null);
    }

    @Override
    public String toString() {
        return StringUtil.simpleClassName(this) +
                '[' +
                "clientId=" + clientId +
                ", username=" + username +
                ", password=" + password +
                ']';
    }
}
